/*
 * Copyright 2021 Muii
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.gitee.muii.echarts.label;

import java.io.Serializable;

import com.gitee.muii.echarts.constant.number.FontWeightNumber;
import com.gitee.muii.echarts.constant.string.Align;
import com.gitee.muii.echarts.constant.string.FontStyle;
import com.gitee.muii.echarts.constant.string.FontWeight;
import com.gitee.muii.echarts.constant.string.Position;
import com.gitee.muii.echarts.constant.string.VerticalAlign;
import com.gitee.mysmlz.echarts.Function;
import com.google.common.annotations.Beta;

import lombok.Data;

@Data
public class Label implements Serializable {

    private static final long serialVersionUID = -2183652399360598078L;

    private Boolean show;
    private Object position;
    private Double distance;
    private Double rotate;
    private Double offset;
    private Object formatter;
    private String color;
    private String fontStyle;
    private Object fontWeight;
    private String fontFamily;
    private Double fontSize;
    private String align;
    private String verticalAlign;
    private Double lineHeight;
    private String backgroundColor;
    private String borderColor;
    private Double borderWidth;
    private Double borderRadius;
    private Object padding;
    private String shadowColor;
    private Double shadowBlur;
    private Double shadowOffsetX;
    private Double shadowOffsetY;
    private Object width;
    private Object height;
    private String textBorderColor;
    private Double textBorderWidth;
    private String textShadowColor;
    private Double textShadowBlur;
    private Double textShadowOffsetX;
    private Double textShadowOffsetY;
    @Beta
    private Object rich;

    public void setPosition(String position) {
        this.position = Position.getInstance().propertyOrDefault(position);
    }

    public void setPosition(String[] position) {
        this.position = position;
    }

    public void setPosition(Double[] position) {
        this.position = position;
    }

    public void setFormatter(Function formatter) {
        this.formatter = formatter;
    }

    public void setFormatter(String formatter) {
        this.formatter = formatter;
    }

    public void setFontStyle(String fontStyle) {
        this.fontStyle = FontStyle.getInstance().propertyOrDefault(fontStyle);
    }

    public void setFontWeight(String fontWeight) {
        this.fontWeight = FontWeight.getInstance().propertyOrDefault(fontWeight);
    }

    public void setFontWeight(Double fontWeight) {
        this.fontWeight = FontWeightNumber.getInstance().propertyOrDefault(fontWeight);
    }

    public void setAlign(String align) {
        this.align = Align.getInstance().propertyOrDefault(align);
    }

    public void setVerticalAlign(String verticalAlign) {
        this.verticalAlign = VerticalAlign.getInstance().propertyOrDefault(verticalAlign);
    }

    public void setPadding(Double padding) {
        this.padding = padding;
    }

    public void setPadding(Double[] padding) {
        this.padding = padding;
    }

    public void setWidth(String width) {
        this.width = width;
    }

    public void setWidth(Double width) {
        this.width = width;
    }

    public void setHeight(String height) {
        this.height = height;
    }

    public void setHeight(Double height) {
        this.height = height;
    }

}
